package com.tinyideatech.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tinyideatech.system.entity.MallClassify;
import com.tinyideatech.system.entity.MallOrder;
import com.tinyideatech.system.mapper.MallClassifyMapper;
import com.tinyideatech.system.service.IMallClassifyService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhangy-5
 * @date 2019-08-26
 */
@Service
public class MallClassifyServiceImpl extends ServiceImpl<MallClassifyMapper, MallClassify> implements IMallClassifyService {

    @Override
    public void changeStatus(MallClassify mallClassify) {
        MallClassify classify = getById(mallClassify.getClassifyId());
        if(classify != null){
            classify.setStatus(mallClassify.getStatus());
            updateById(classify);
        }
    }

    @Override
    public List<MallClassify> selectList() {
        QueryWrapper<MallClassify> qw = new QueryWrapper<>();
        qw.eq("status", 1);
        qw.orderByAsc("sort");
        return super.list(qw);
    }
}
